//
//  InTrainingHeaderCollectionCell.swift
//  DaRings
//
//  Created by 尹琼 on 2022/11/29.
//

import UIKit
import MYModule

open class InTrainingTargetCollectionCell: CollectionViewCell {
    
    open var model: InTrainingModel? {
        
        didSet {
            
            guard let model = model else {
                return
            }
            
            targetLabel.attributedText = model.targetAttriText
            
            if model.viceItem?.contentType != .time {
                viceLabel.text = "\(model.viceItem?.currentDataTitle ?? "--") \(model.viceItem?.unit ?? "")"
            } else {
                viceLabel.text = model.viceItem?.currentDataTitle
            }
        }
    }
    
    open override func makeUI() {
        super.makeUI()
        
        contentView.addSubview(targetLabel)
        contentView.addSubview(viceLabel)
        
        self.targetLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalToSuperview()
            make.leading.equalToSuperview()
        }
       
        self.viceLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(self.targetLabel.snp.bottom).offset(16)
            make.leading.equalToSuperview()
        }
    }
    
    private lazy var targetLabel: Label = {
        let label = Label()
        label.font = Fonts.boldSystemFont(ofSize: 70)
        label.textColor = UIColor.assist_222222
        label.textAlignment = .center
        return label
    }()
    
    private lazy var viceLabel: Label = {
        let label = Label()
        label.font = Fonts.boldSystemFont(ofSize: 28)
        label.textColor = UIColor.assist_222222
        label.textAlignment = .center
        return label
    }()
    

}
